package com.phonegap.gwt.geolocation.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.phonegap.gwt.geolocation.client.impl.GeolocationImpl;

public class Geolocation extends JavaScriptObject {

	public static boolean isSupported() {
		return impl.isSupported();
	}

	private final static GeolocationImpl impl = GWT
			.create(GeolocationImpl.class);

	protected Geolocation() {
	}

	public final void getCurrentPosition(PositionCallback callback) {
		impl.getCurrentPosition(this, callback);
	}
	
	public final int watchPosition(PositionCallback callback) {
		return impl.watchPosition(this, callback);
	}

	public final int watchPosition(PositionCallback callback,PositionOptions options) {
		return impl.watchPosition(this, callback, options);
	}
	
	public final void clearWatch(int watchId) {
		impl.clearWatch(this, watchId);
	}
	
	//void clearWatch(int watchId)
	//  int watchPosition(successCallback, [errorCallback], [options])
	  

	public final void getCurrentPosition(PositionCallback callback,
			PositionOptions options) {
		impl.getCurrentPosition(this, callback, options);
	}

	/**
	 * Returns the Geolocation object.
	 */
	public static Geolocation getGeolocation() {
		return impl.getGeolocation();
	}

}
